package com.yx.config;

import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.serializer.RedisSerializer;

/**
 * @Classname SpringSessionConfig
 * @Date 2021/07/15 16:41
 * @Author by yx
 * @Description : session的json序列化存入redis
 */
@Configuration
public class SpringSessionConfig {
    /*
    * 使用fastjson实现json序列化,导入依赖1.2.76,以下版本会出现不兼容问题
    * */
    @Bean
    public RedisSerializer<Object> springSessionDefaultRedisSerializer(){
        return new GenericFastJsonRedisSerializer();
    }
}
